package com.etone.smartAudit.utils;

import java.text.DecimalFormat;
import java.text.NumberFormat;

/**
 * @author: sovy
 * @date: 2021/3/23
 * @description:
 */
public class NumberUtil {

    /**
     * Double 保留两位小数
     *
     * @return
     */
    public static Double double2decimal(Double dou) {
        return dou == null ? 0D : (Math.round(dou * 100D) / 100d);
    }

    /**
     * 显示非科学计数法
     *
     * @return
     */
    public static String double2String(Double dou) {
        NumberFormat nf = NumberFormat.getInstance();
        return nf.format(dou);
    }
}
